package coroutines.coroutine

import kotlin.coroutines.*

class CreateCoroutineTest {

}

fun main() {
    val contionuation = suspend {
        println("Create Coroutine")
        5
    }.createCoroutine(object : Continuation<Int> {
        override fun resumeWith(result: Result<Int>) {
            println("Coroutine resumeWith() result.value = ${result.getOrNull()}")
        }

        override val context: CoroutineContext = EmptyCoroutineContext
    })

    contionuation.resume(Unit)

    println()

    suspend{
        println("Start Coroutine")
        2233
    }.startCoroutine(object :Continuation<Int>{
        override val context: CoroutineContext = EmptyCoroutineContext

        override fun resumeWith(result: Result<Int>) {
            println("Start Coroutine value = ${result.getOrNull()}")
        }
    })
}